package com.jvyou.app.common.domain.vo;

import com.jvyou.app.common.utils.tree.TreeUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author 橘柚
 * @since 2025/3/6 17:48
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MenuTreeVo implements TreeUtils.TreeNode<Long> {

    /**
     * 菜单ID
     */
    private Long id;


    private Long parentId;

    /**
     * 菜单名称
     */
    private String name;

    private List<MenuTreeVo> children;


    @Override
    public Long id() {
        return this.id;
    }

    @Override
    public Long parentId() {
        return this.parentId;
    }

    @Override
    public boolean root() {
        return this.parentId == 0;
    }

    @Override
    public void setChildren(List<? extends TreeUtils.TreeNode<Long>> children) {
        this.children = (List<MenuTreeVo>) children;
    }

    @Override
    public List<? extends TreeUtils.TreeNode<Long>> getChildren() {
        return children;
    }
}
